﻿<?php
require_once(dirname(__FILE__)."/../../libs/login/login.php");  
require_once(dirname(__FILE__)."/../../libs/string/libstr.php");
require_once(dirname(__FILE__)."/../../admin/libs/shuxing_class.php");
$lg=new login();
$lg->checklogin("admin_member");//检验是否登录
$mc=new libstr();
$sx=new shuxing();

//获取所有属性

$allsx=$sx->getshuxingtype();
$tb=$allsx[0]["ziduan"]."_class";//默认第一个属性
$_sx=$allsx[0]["ziduan"];
if($mc->Ismp($_GET["sx"])!=""){
$tb=$_GET["sx"]."_class";	
$_sx=$_GET["sx"];
}

//获得某个的属性的详细列表
$getrs=$sx->getshuxinglist($tb);
//删除一个属性
//echo $_GET["del"];
if($mc->Ismp($_GET["del"]!="")){
	$sx->deleteshuxing($tb,$_GET["del"]);
	$mc->msg("","shuxing_class.php?sx=".$_sx);	
	
}
//获得全部属性种类

$path="属性列表";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理系统</title>
<script type="text/javascript" src="../js/jquery.js"></script>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<body style="background:#fff"> 

<div class="content">
    <div class="right">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
        <td width="100%" height="24" class="top_head">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="1%" align="right"  height="45">&nbsp;</td>
                <td width="99%" >
                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="55%" style="padding-left:20px;padding-top:10px;"><img src="../images/head.gif" width="13" height="11"><b><?php echo $path;?></b><a href="shuxing_add.php?sx=<?php echo $_sx;?>" style=" margin-left:20px; text-decoration:underline;">添加属性</a></td>
                    <td width="45%" align="right">&nbsp;</td>
                  </tr>
                </table>
                </td>
              </tr>
            </table>
        </td>
      </tr>
      <tr>
        <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="bg">
          <tr >
            <td valign="middle"  style=" padding:5px 0 5px 0;" >
            	<table width="92%"  border="0" cellspacing="0" align="center">
                	<tr>
                    	<td width="20%" align="left">&nbsp;</td>
                    	<td width="80%">
                              <div class="xuanze2">
                              <form method="GET" action="" id="shuxing"><select name="sx" onchange="$('#shuxing').submit()">
								  <?php foreach($allsx as $rs){?>
                                    <option value="<?php echo $rs["ziduan"]?>" <?php if($_GET['sx']==$rs["ziduan"]){?>selected<?php }?> ><?php echo $rs["classname"]; ?></option>
                                   <?php }?> 
                                    </select>
                              </form>
                              </div>
                        </td>
                    </tr>
                </table>
             </td>
          </tr>
    	  <tr>
            <td valign="middle" align="center" >
            	<table width="92%"   border="1px" bordercolor="#ccc" cellspacing="0px" style="border-collapse:collapse">
                  <thead align="center" bgcolor="#EEEEEE">
                    <tr>
                	<th height="30" align="center">属性分类</th>
                    <th width="25%" colspan="-4" align="center"><strong>排序</strong></th>
                    <th width="25%" colspan="-3" align="center">编辑</th>
                </tr>
              </thead>
              <tbody>
              <?php foreach($getrs as $rs){?>
              	<tr>
                	<td width="49%" height="28" align="center"><?php echo $rs["classname"]?></td>
                    <td height="28" align="center"><input name="classorder<?php echo  $rs["classorder"];?>" value="<?php echo $rs["classorder"];?>" style="border:1px solid #ccc; width:20px; text-align:center"></td>
                    <td height="28" align="center">
                    <bdo><input type="submit" name="button2" id="button2" value="修改" onclick="location.href='shuxing_edit.php?id=<?php echo $rs["ID"];?>&sx=<?php echo $_GET["sx"];?>'"/></bdo>
                      <bdo><input type="submit" name="button3" id="button3" value="删除" onclick="if(confirm('您确定删除本项吗?')){location.href='?del=<?php echo $rs["ID"];?>&sx=<?php echo $_GET["sx"];?>'}"/>
                    </bdo></td>
                </tr>
     <?php }?>
              </tbody>
            
        </table>
        </td>
      </tr>
    </table>
    
    </div>
</div>
</body>
</html>